package com.yuyou.train.user.vo.resp;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class RespGetLessonExamComp implements Comparator<RespGetLessonExam>{

	@Override
	public int compare(RespGetLessonExam v1, RespGetLessonExam v2) {			
		int flag=v2.getPer().compareTo(v1.getPer());
		if(flag==0){
			return v2.getExamTime().compareTo(v1.getExamTime());
		}else{
			return flag;
		}
	}


	public static void main(String[] args) {
		
		RespGetLessonExam v1=new  RespGetLessonExam();
		v1.setPer(1.25);
		v1.setExamTime(1);
		v1.setExamName("1");
		
		RespGetLessonExam v2=new  RespGetLessonExam();
		v2.setPer(2.0);
		v2.setExamTime(2);
		v2.setExamName("2");
		
		
		List<RespGetLessonExam> list=new ArrayList<RespGetLessonExam>();
		list.add(v1);
		list.add(v2);
		list.add(v1);
		
		RespGetLessonExamComp userLessonProgressExamVOComp=new RespGetLessonExamComp();
		Collections.sort(list,userLessonProgressExamVOComp);
		
		list.forEach(item->{  
            System.out.println(item.getExamName());  
        });
		
		
	}

		
	
	
}
